package cn.kwq.project_manger.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpUtil;
import cn.kwq.project_manger.common.R;
import cn.kwq.project_manger.common.RES;
import cn.kwq.project_manger.pojo.InstituteDic;
import cn.kwq.project_manger.pojo.User;
import cn.kwq.project_manger.pojo.dto.FindDicDto;
import cn.kwq.project_manger.pojo.dto.LoginDto;
import cn.kwq.project_manger.repostitory.InstituteDicRepository;
import cn.kwq.project_manger.service.DicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

@Slf4j
@Api(tags ="字典")
@RestController
@RequestMapping("/dic/")
public class DicController {


    @Autowired
    DicService dicService;

    @ApiOperation("获取学院信息")
    @SaIgnore//可以匿名访问该接口
    @PostMapping("getInstituteDic")
    public RES getInstituteDic(@RequestBody FindDicDto dto) {
        return R.ok(dicService.searchInstituteDic(dto.getDicName(),dto.getPageSize(),dto.getPageNum()));
    }

    @ApiOperation("获取专业信息")
    @SaIgnore//可以匿名访问该接口
    @PostMapping("getMajorDic")
    public RES getMajorDic(@RequestBody FindDicDto dto) {
        return R.ok(dicService.searchMajorDic(dto.getDicName(),dto.getPageSize(),dto.getPageNum()));
    }
}
